package com.ld.rightsSystem.mapper;

import com.ld.rightsSystem.pojo.TrRolePermission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * <p>
 * 用户信息表 Mapper 接口
 * </p>
 *
 * @author lhb
 * @since 2023-12-27
 */
@Repository
public interface TrRolePermissionRepository extends JpaRepository<TrRolePermission,Long> {
    @Transactional
    int deleteTrRolePermissionByRoleId(Long RoleId);

    @Query(value = "select permission_id from auth.tr_role_permission where role_id=:roleId",nativeQuery = true)
    List<Long> findPermissionIdsByRoleId(@Param("roleId")Long roleId);
}
